﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;
using System.Windows.Media;
using BrainTechLLC;

namespace BrainTechLLC.WPF
{
    public class GraphContext : Canvas
    {
#if SILVERLIGHT
#else
        public event EventHandler<ObjectEventArgs<DrawingContext>> RequestRender;
        public event EventHandler<ObjectEventArgs<SizeChangedInfo>> RenderSizeChanged;
#endif

#if SILVERLIGHT
#else

        protected override void OnRender(DrawingContext drawingContext)
        {
            if (RequestRender != null)
            {
                RequestRender(this, new ObjectEventArgs<DrawingContext>(drawingContext));
            }
            else
            {
                base.OnRender(drawingContext);
            }
        }
#endif

#if SILVERLIGHT
#else
        protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
        {
            base.OnRenderSizeChanged(sizeInfo);

            if (RenderSizeChanged != null)
                RenderSizeChanged(this, new ObjectEventArgs<SizeChangedInfo>(sizeInfo));
        }
#endif
    }
}
